import { ref } from 'vue'
import { defineStore } from 'pinia'
import { getCategory } from '../api/api/getCategory'
import { List, upd } from '@/api/api/list'

export const useList = defineStore('list', () => {
    const data = ref([])
    const datalist = ref([])
    function getData() {
        getCategory().then(res => {
            data.value = res.data.data
            //console.log(res.data.data)
        })
    }
    function getList() {
        List().then(res => {
            // //console.log(res.data.data)
            datalist.value = res.data.data
        })
    }
    function Upde(id, obj) {
        upd(id, obj).then(res => {
            //console.log('res', res)
        })
    }

    return { data, getData, getList, datalist, Upde }
})